package com.cloudbroker.bcs.platform.ltb.middle.service.impl;

import com.cloudbroker.bcs.common.dao.base.DAOBase;
import com.cloudbroker.bcs.platform.ltb.middle.dao.CombineDAO;
import com.cloudbroker.bcs.platform.ltb.middle.entity.CombinationEntity;
import com.cloudbroker.bcs.platform.ltb.middle.service.CombineService;
import com.cloudbroker.bcs.platform.ltb.middle.service.base.TenantServiceImplBase;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by tianrui on 2016/7/22.
 */
@Service
public class CombineServiceImpl extends TenantServiceImplBase<CombinationEntity, String>
        implements CombineService {


    @Resource
    private CombineDAO combineDAO;

    @Override
    protected DAOBase<CombinationEntity, String> getDAO() {
        return combineDAO;
    }

    @Override
    public void addCombineInfo(CombinationEntity combinationEntity) {
        super.save(combinationEntity);
    }

    @Override
    public void combineFocus(CombinationEntity combinationEntity) {
        combineDAO.upCombineFocusNum(combinationEntity);
    }

    @Override
    public void combineFocusCancel(CombinationEntity combinationEntity) {
        combineDAO.downCombineFocusNum(combinationEntity);
    }

    @Override
    public CombinationEntity getCombinationByCode(String code) {
        return combineDAO.getCombinationByCode(code);
    }

    @Override
    public int combineNameIsExist(String codeName) {
        return combineDAO.combineNameIsExist(codeName);
    }

    @Override
    public void upCombination(CombinationEntity combinationEntity) {
        super.update(combinationEntity);
    }
}
